#ifndef WIN_BASE_H
#define WIN_BASE_H

#include "thrid.hpp"
#include "qt_api.hpp"
#include "pg_base.hpp"
#include "wg_loading.hpp"
#include "sgt_style.hpp"

class WinBase : public QMainWindow
{
    Q_OBJECT

public:
    explicit WinBase(QWidget *parent = nullptr,const std::string& name_="base");
    ~WinBase();
protected:
    void loading_end();
    void loading(const QString tips = "");

    void page_reset();
    void page_show(const QString key);
    void page_add(const QString key, PgBase* page);
    void page_add(QPushButton* btn, PgBase* page);
    void set_pg_container(QVBoxLayout* pg_container_);
public slots:
    void slot_page_switch();
    void slot_loading_end();
    void slot_loading(const QString tips);
private:
    std::string name;
    WgLoading* wg_loading;
    QVBoxLayout* pg_container;
    std::map<QString, PgBase*> pages;
    std::shared_ptr<spdlog::logger> logger;

    void init_ui();
    void init_style();
};

#endif
